package org.windowkit.toolkit.print;

import java.awt.Dimension;

import sun.awt.windows.WPrinterJob;

/**
 * This class is an extension of WPrinterJob to get around the fact that the
 * scale values given by the print system are not accurate when the user changes
 * the quality value from the print window. This class is super hack and should
 * be thrown away as soon as Java learns how to print.
 *
 * @author Eric Lundin
 */
public class PrinterJob extends WPrinterJob {

	public PrinterJob() {
		super();
	}

	/**
	 * Returns the resolution of the printer.
	 *
	 * @return The printers resolution as a Dimenion with the X resolution and Y
	 *         resolution.
	 */
	public Dimension getDPI() {
		Dimension retVal = new Dimension();
		retVal.setSize(getXRes(), getYRes());
		return retVal;
	}

//	 public static PrinterJob getPrinterJob() {
//			SecurityManager security = System.getSecurityManager();
//			if (security != null) {
//			    security.checkPrintJobAccess();
//			}
//			return (PrinterJob) java.security.AccessController.doPrivileged(
//			    new java.security.PrivilegedAction() {
//			    public Object run() {
//				String nm = System.getProperty("java.awt.printerjob", null);
//				try {
//				    return (PrinterJob)Class.forName(nm).newInstance();
//				} catch (ClassNotFoundException e) {
//				    throw new AWTError("PrinterJob not found: " + nm);
//				} catch (InstantiationException e) {
//				 throw new AWTError("Could not instantiate PrinterJob: " + nm);
//				} catch (IllegalAccessException e) {
//				    throw new AWTError("Could not access PrinterJob: " + nm);
//				}
//			    }
//			});
//		    }
}
